package com.ruoyi.nongjt.service.impl;

import com.ruoyi.common.utils.SecurityUtils;
import com.ruoyi.nongjt.domain.NjtUserRegister;
import com.ruoyi.nongjt.mapper.NjtUserRegisterMapper;
import com.ruoyi.nongjt.service.NjtUserRegisterService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.Date;
import java.util.List;

@Service
@Transactional(rollbackFor = Exception.class)
public class NjtUserRegisterServiceImpl implements NjtUserRegisterService {
    @Autowired
    private NjtUserRegisterMapper njtUserRegisterMapper;

    @Override
    public List<NjtUserRegister> getNjtUserRegisterList(NjtUserRegister njtUserRegister) {
        return njtUserRegisterMapper.selectNjtUserRegisterList(njtUserRegister);
    }

    @Override
    public int updateNjtUserRegister(NjtUserRegister njtUserRegister) {
        njtUserRegister.setUpdateBy(SecurityUtils.getUsername());
        njtUserRegister.setUpdateTime(new Date());
        return njtUserRegisterMapper.updateNjtUserRegister(njtUserRegister);
    }

    @Override
    public int deleteById(Long id){
        return njtUserRegisterMapper.deleteById(id);}

    @Override
    public List<NjtUserRegister> getNjtRegisterList(NjtUserRegister njtUserRegister) {
        // 调用Mapper层方法执行数据库查询
        // 实际查询条件由MyBatis的XML映射文件或注解SQL定义
        return njtUserRegisterMapper.selectNjtUserRegisterList(njtUserRegister);
    }


}